//
//  CommonViewController.m
//  collection
//
//  Created by 张靖 on 4/21/12.
//  Copyright (c) 2012 Tsinghua University. All rights reserved.
//

#import "CommonViewController.h"
#import "LoginController.h"
#import "RegisterController.h"

@interface CommonViewController ()

- (IBAction)onClickLoginButton:(id)sender;
- (IBAction)onClickRegisterButton:(id)sender;

@end

@implementation CommonViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

#pragma mark - Private methods

- (IBAction)onClickLoginButton:(id)sender {
    
    LoginController* loginController = [[LoginController alloc] initWithNibName:@"LoginController" bundle:nil];
    [self presentModalViewController:loginController animated:YES];
    //    [self.navigationController pushViewController:loginController animated:YES];
    [loginController release];
}

- (IBAction)onClickRegisterButton:(id)sender {
    
    RegisterController* registerController = [[RegisterController alloc] initWithNibName:@"RegisterController" bundle:nil];
    [self.navigationController presentModalViewController:registerController animated:YES];
    [registerController release];
}

@end
